#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <math.h>
int sicifang(int x)
{
	int sum = 0;
	while (x)
	{
		int s=x % 10;
		int f= pow(s, 4);
		sum += f;
		x /= 10;
	}
	return sum;
}
int main()
{
	int a = 0;
	int b = 0;
	scanf("%d %d", &a, &b);
	for (int i = a; i <= b; i++)
	{
		int c=sicifang(i);
		if (c == i)
		{
			printf("%d ",i);
		}

	}
	return 0;
}